﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Markup;

namespace WQDSkin.Forms.Controls
{
    [MarkupExtensionReturnType(typeof(object))]
    public class StaticResourceExtension : MarkupExtension
    {
        private readonly object resourceKey;

        public StaticResourceExtension(object resourceKey)
        {
            this.resourceKey = resourceKey;
        }
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            if (this.resourceKey is WQDSystemResourceKey)
            {
                return ((WQDSystemResourceKey)this.resourceKey).Resource;
            }
            return null;
        }
    }
}
